/* Deque - Decompiled by JODE
 * Visit http://jode.sourceforge.net/
 */

public class Deque {
	public static JString aClass3_909;
	public static JString aClass3_910;
	public static int[] anIntArray911 = { 12800, 12800, 12800, 12800, 12800, 12800, 12800, 12800, 12800, 12800, 12800, 12800, 12800, 12800, 12800, 12800 };
	public static int anInt912;
	public static JString aClass3_913;
	public static boolean aBoolean914;
	public static int anInt915 = 0;
	public static Class7 aClass7_916;
	public static JString aClass3_917;
	public static Class9 aClass9_918;
	public static int anInt919;
	public static Class39_Sub5_Sub10_Sub3 aClass39_Sub5_Sub10_Sub3_920;
	public static JString aClass3_921;
	public Node aClass39_922 = new Node();
	public static RSSocket aClass16_923;
	public Node aClass39_924;
	public static JString aClass3_925;
	public static JString aClass3_926;
	public static JString aClass3_927;

	public void method953(int i) {
		for (;;) {
			Node class39 = aClass39_922.next;
			if (class39 == aClass39_922)
				break;
			class39.unlink();
		}
	}

	public static JString longToString(long l, byte i) {
		if (l <= 0L || l >= 6582952005840035281L)
			return null;
		if (l % 37L == 0L)
			return null;
		long l_0_ = l;
		int i_1_ = 0;
		while (l_0_ != 0L) {
			l_0_ /= 37L;
			i_1_++;
		}
		byte[] is = new byte[i_1_];
		while (l != 0L) {
			long l_2_ = l;
			l /= 37L;
			is[--i_1_] = Class7.aByteArray111[(int) (-(l * 37L) + l_2_)];
		}
		JString class3 = new JString();
		class3.characters = is;
		class3.length = is.length;
		return class3;
	}

	public static boolean method955(int i, int i_3_, int i_4_, int i_5_, int i_6_, int i_7_, int i_8_) {
		if (i_7_ != -1)
			anInt919 = 72;
		if (!RSSocket.method219(i_7_ ^ 0xffffffff, i_5_))
			return false;
		return Class20.drawInterface((Class62_Sub1.interfaceCache[i_5_]), i_8_, 0, -1, i_6_, 0, i_3_, 9843, i, i_4_);
	}

	public void method956(Node class39) {
		if (class39.previous != null)
			class39.unlink();
		class39.next = aClass39_922;
		class39.previous = aClass39_922.previous;
		class39.previous.next = class39;
		class39.next.previous = class39;
	}

	public Node method957() {
		Node class39 = aClass39_924;
		if (aClass39_922 == class39) {
			aClass39_924 = null;
			return null;
		}
		aClass39_924 = class39.previous;
		return class39;
	}

	public static void method958(byte i, int i_9_) {
		int[] is = (Class39_Sub5_Sub4_Sub2.aClass39_Sub5_Sub10_Sub3_2219.anIntArray2476);
		int i_10_ = is.length;
		for (int i_11_ = 0; i_10_ > i_11_; i_11_++)
			is[i_11_] = 0;
		for (int i_12_ = 1; i_12_ < 103; i_12_++) {
			int i_13_ = (52736 - i_12_ * 512) * 4 + 24628;
			for (int i_14_ = 1; i_14_ < 103; i_14_++) {
				if ((Class55.tileSettings[i_9_][i_14_][i_12_] & 0x18) == 0)
					Class44.aClass38_836.method387(is, i_13_, 512, i_9_, i_14_, i_12_);
				if (i_9_ < 3 && ((Class55.tileSettings[i_9_ + 1][i_14_][i_12_]) & 0x8) != 0)
					Class44.aClass38_836.method387(is, i_13_, 512, i_9_ + 1, i_14_, i_12_);
				i_13_ += 4;
			}
		}
		Class39_Sub5_Sub4_Sub2.aClass39_Sub5_Sub10_Sub3_2219.method679();
		int i_15_ = (((int) (Math.random() * 20.0) - 10 + 238 << 8) + ((int) (Math.random() * 20.0) + 238 - 10 << 16) - (-(int) (Math.random() * 20.0) + 10) + 238);
		int i_16_ = (int) (Math.random() * 20.0) + 228 << 16;
		for (int i_17_ = 1; i_17_ < 103; i_17_++) {
			for (int i_18_ = 1; i_18_ < 103; i_18_++) {
				if ((Class55.tileSettings[i_9_][i_18_][i_17_] & 0x18) == 0)
					Class50.paintMapScene(i_9_, 1536, i_15_, i_18_, i_17_, i_16_);
				if (i_9_ < 3 && ((Class55.tileSettings[i_9_ + 1][i_18_][i_17_]) & 0x8) != 0)
					Class50.paintMapScene(i_9_ + 1, 1536, i_15_, i_18_, i_17_, i_16_);
			}
		}
		anInt915 = 0;
		for (int i_19_ = 0; i_19_ < 104; i_19_++) {
			for (int i_20_ = 0; i_20_ < 104; i_20_++) {
				int i_21_ = Class44.aClass38_836.method404(Class11.currentPlane, i_19_, i_20_);
				if (i_21_ != 0) {
					i_21_ = (i_21_ & 0x1fffd23c) >> 14;
					int i_22_ = Canvas_Sub1.method40(i_21_, (byte) 39).anInt1962;
					if (i_22_ >= 0) {
						int i_23_ = i_20_;
						int i_24_ = i_19_;
						if (i_22_ != 22 && i_22_ != 29 && i_22_ != 34 && i_22_ != 36 && i_22_ != 46 && i_22_ != 47 && i_22_ != 48) {
							int[][] is_25_ = (Class39_Sub5_Sub12.aClass27Array1857[Class11.currentPlane].anIntArrayArray507);
							for (int i_26_ = 0; i_26_ < 10; i_26_++) {
								int i_27_ = (int) (Math.random() * 4.0);
								if (i_27_ == 0 && i_24_ > 0 && i_19_ - 3 < i_24_ && ((is_25_[i_24_ - 1][i_23_] & 0x1280108) == 0))
									i_24_--;
								if (i_27_ == 1 && i_24_ < 103 && i_19_ + 3 > i_24_ && ((is_25_[i_24_ + 1][i_23_] & 0x1280180) == 0))
									i_24_++;
								if (i_27_ == 2 && i_23_ > 0 && i_20_ - 3 < i_23_ && ((is_25_[i_24_][i_23_ - 1] & 0x1280102) == 0))
									i_23_--;
								if (i_27_ == 3 && i_23_ < 103 && i_20_ + 3 > i_23_ && ((is_25_[i_24_][i_23_ + 1] & 0x1280120) == 0))
									i_23_++;
							}
						}
						Class31.aClass39_Sub5_Sub10_Sub3Array560[anInt915] = (Class39_Sub5_Sub4_Sub1.aClass39_Sub5_Sub10_Sub3Array2205[i_22_]);
						Class46_Sub1.anIntArray1549[anInt915] = i_24_;
						RSInterface.anIntArray2111[anInt915] = i_23_;
						anInt915++;
					}
				}
			}
		}
	}

	public void method959(byte i, Node class39, Node class39_28_) {
		if (i != -15)
			aClass3_917 = null;
		if (class39_28_.previous != null)
			class39_28_.unlink();
		class39_28_.previous = class39.previous;
		class39_28_.next = class39;
		class39_28_.previous.next = class39_28_;
		class39_28_.next.previous = class39_28_;
	}

	public Node method960(int i) {
		Node class39 = aClass39_922.previous;
		if (class39 == aClass39_922)
			return null;
		class39.unlink();
		return class39;
	}

	public static void method961(byte i, Stream class39_sub6, int i_29_, int i_30_, int i_31_, int i_32_, int i_33_, int i_34_) {
		if (i_33_ < 0 || i_33_ >= 104 || i_31_ < 0 || i_31_ >= 104) {
			for (;;) {
				int i_35_ = class39_sub6.readByte((byte) -8);
				if (i_35_ == 0)
					break;
				if (i_35_ == 1) {
					class39_sub6.readByte((byte) -8);
					break;
				}
				if (i_35_ <= 49)
					class39_sub6.readByte((byte) -8);
			}
		} else {
			Class55.tileSettings[i_34_][i_33_][i_31_] = (byte) 0;
			for (;;) {
				int i_36_ = class39_sub6.readByte((byte) -8);
				if (i_36_ == 0) {
					if (i_34_ != 0)
						Class67.anIntArrayArrayArray1175[i_34_][i_33_][i_31_] = (Class67.anIntArrayArrayArray1175[i_34_ - 1][i_33_][i_31_]) - 240;
					else
						Class67.anIntArrayArrayArray1175[0][i_33_][i_31_] = (-Class62.method1057(i_32_ + i_31_ + 556238, 932731 + i_33_ + i_30_, 1) * 8);
					break;
				}
				if (i_36_ == 1) {
					int i_37_ = class39_sub6.readByte((byte) -8);
					if (i_37_ == 1)
						i_37_ = 0;
					if (i_34_ != 0)
						Class67.anIntArrayArrayArray1175[i_34_][i_33_][i_31_] = (Class67.anIntArrayArrayArray1175[i_34_ - 1][i_33_][i_31_]) - i_37_ * 8;
					else
						Class67.anIntArrayArrayArray1175[0][i_33_][i_31_] = -i_37_ * 8;
					break;
				}
				if (i_36_ <= 49) {
					Class33.tileOverlay[i_34_][i_33_][i_31_] = class39_sub6.readSignedByte(-128);
					Class67.tileShapes[i_34_][i_33_][i_31_] = (byte) ((i_36_ - 2) / 4);
					ISAAC.tileOrientation[i_34_][i_33_][i_31_] = (byte) Class34.method342(i_36_ + i_29_ - 2, 3);
				} else if (i_36_ <= 81)
					Class55.tileSettings[i_34_][i_33_][i_31_] = (byte) (i_36_ - 49);
				else
					Class39_Sub14.tileUnderlay[i_34_][i_33_][i_31_] = (byte) (i_36_ - 81);
			}
		}
	}

	public Node method962(int i) {
		Node class39 = aClass39_922.previous;
		if (aClass39_922 == class39) {
			aClass39_924 = null;
			return null;
		}
		aClass39_924 = class39.previous;
		return class39;
	}

	public Node method963(byte i) {
		Node class39 = aClass39_924;
		if (class39 == aClass39_922) {
			aClass39_924 = null;
			return null;
		}
		aClass39_924 = class39.next;
		return class39;
	}

	public static void method964(int i) {
		Class45.lowDetail = false;
		World.aBoolean684 = false;
	}

	public Node method965(byte i) {
		Node class39 = aClass39_922.next;
		if (class39 == aClass39_922)
			return null;
		class39.unlink();
		return class39;
	}

	public void method966(Node class39, int i) {
		if (class39.previous != null)
			class39.unlink();
		class39.previous = aClass39_922;
		class39.next = aClass39_922.next;
		class39.previous.next = class39;
		class39.next.previous = class39;
	}

	public static void method967(RSInterface class39_sub5_sub17, byte i) {
		int i_38_ = class39_sub5_sub17.anInt2084 >> 16;
		if (Tile.anInt1912 == i_38_ || ISAAC.anInt1095 == i_38_)
			Class14.aBoolean245 = true;
		if (Class39_Sub5_Sub4_Sub5.openSidebarInterface == i_38_ || i_38_ == Tile.anIntArray1914[Node.anInt728])
			Class39_Sub14.aBoolean1520 = true;
	}

	public static void method968(byte i) {
		anIntArray911 = null;
		aClass3_910 = null;
		aClass3_921 = null;
		aClass3_925 = null;
		aClass9_918 = null;
		aClass39_Sub5_Sub10_Sub3_920 = null;
		aClass3_917 = null;
		aClass3_913 = null;
		aClass3_909 = null;
		aClass7_916 = null;
		aClass3_926 = null;
		aClass3_927 = null;
		aClass16_923 = null;
	}

	public Node method969(boolean bool) {
		Node class39 = aClass39_922.next;
		if (aClass39_922 == class39) {
			aClass39_924 = null;
			return null;
		}
		aClass39_924 = class39.next;
		return class39;
	}

	public Deque() {
		aClass39_922.previous = aClass39_922;
		aClass39_922.next = aClass39_922;
	}

	static {
		aBoolean914 = false;
		aClass3_917 = Class39_Sub5_Sub9.createJString(112, "welle:");
		aClass3_921 = Class39_Sub5_Sub9.createJString(111, "Password: ");
		anInt912 = 78;
		aClass3_909 = Class39_Sub5_Sub9.createJString(114, "Handel)4Duell");
		aClass3_913 = Class39_Sub5_Sub9.createJString(114, "Offline");
		aClass3_910 = aClass3_921;
		aClass7_916 = new Class7(20);
		aClass3_925 = Class39_Sub5_Sub9.createJString(107, "Loading fonts )2 ");
		aClass3_927 = Class39_Sub5_Sub9.createJString(114, "mapdots");
		aClass3_926 = aClass3_925;
	}
}
